<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    // const 常量
    // let  var
    let strArrs = ["America", "Greece", "Britain", "Canada", "China", "Egypt"];
    let num = 0; //计数
    //循环
    for (let str of strArrs) {
        // 包含a或者A 转小写 判断a
        if (str.toLowerCase().indexOf("a") != -1) num ++;
        document.write(str+"<br>")
    }
    document.write("共有"+num+"个字符串中包含a或A<br>");

    let str =  strArrs.join("");
    document.write("a或A出现的次数:"+(str.toLowerCase().split("a").length - 1));

    alert(str.match(/a/ig).length);
</script>
</body>
</html>